package com.chb.docter.controller.apis;

import com.chb.docter.service.PatientFileService;
import com.hos.entity.his.PatientFile;
import com.hos.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: 陈海彬
 * @date: Created in 2023/12/26 11:02
 * @description:
 * @modified By:
 * @version:
 */
@Api(tags = "患者详细信息相关接口")
@RestController
@RequestMapping("/docter/api/patientFile")
public class ApiPatientFileController {

    @Resource
    private PatientFileService patientFileService;

    @PostMapping("addFile")
    @ApiOperation("添加患者详细信息")
    public Result<PatientFile> addFile(@RequestBody PatientFile patientFile) {
        return new Result<>(200, "添加成功", patientFileService.addFile(patientFile));
    }

    @GetMapping()
    @ApiOperation("获取患者信息列表")
    public Result<List<PatientFile>> getAllPatientFile() {
        return new Result<>(200, "查询成功", patientFileService.getAllPatientFile());
    }

    @GetMapping("/{id}")
    @ApiOperation("通过id获取患者信息")
    public Result<PatientFile> getPatientFileById(@PathVariable String id) {
        return new Result<>(200, "查询成功", patientFileService.getPatientFileById(id));
    }

    @PutMapping("/{id}")
    @ApiOperation("修改患者详细信息")
    public Result<String> putPatientFileById(@PathVariable String id, @RequestBody PatientFile patientFile) {
        return new Result<>(200, "修改成功", patientFileService.putPatientFileById(id, patientFile));
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除患者详细信息")
    public Result<String> deleteMemberAddressById(@PathVariable String id) {
        return new Result<>(200, "删除成功", patientFileService.deleteMemberAddressById(id));
    }
}